import request from '@/utils/request';
//获取生产工单查询信息
export async function getWorkOrderInforByPage(params: any) {
  return request('/api/product/getWorkOrderInforByPage', {
    method: 'POST',
    data: params,
  });
}
//获取生产工单查询信息拓展
export async function getWorkOrderInforExtendByPage(params: any) {
  return request('/api/product/getWorkOrderInforExtendByPage', {
    method: 'POST',
    data: params,
  });
}

export async function addWorkOrderInfor(params: any) {
  return request('/api/product/addWorkOrderInfor', {
    method: 'POST',
    data: params,
  });
}

export async function updateWorkOrderInfor(params: any) {
  return request('/api/product/updateWorkOrderInfor', {
    method: 'POST',
    data: params,
  });
}

export async function delWorkOrderInfor(params: any) {
  return request('/api/product/delWorkOrderInfor', {
    method: 'POST',
    data: params,
  });
}

//获取工单BOM的信息
export async function getBomOverview(params: any) {
  return request('/api/product/getBomOverview', {
    method: 'POST',
    params: {
      workOrderInfoId: params,
    },
  });
}

//释放工单
export async function releaseWorkOrderInfor(params: any) {
  return request('/api/product/releaseWorkOrderInfor', {
    method: 'POST',
    params: {
      workOrderInfoId: params,
    },
  });
}

//获取该工单的图纸信息
export async function getDrawingInfo(params: any) {
  return request('/api/product/getDrawingInfo', {
    method: 'POST',
    params: {
      workOrderInfoId: params,
    },
  });
}

//获取该工单的生产进度
export async function getManufactInfo(params: any) {
  return request('/api/product/getManufactInfo', {
    method: 'POST',
    params: {
      workOrderInfoId: params,
    },
  });
}

export async function exportWorkOrderInfor(params: any) {
  return request('/api/product/exportWorkOrderInfor', {
    method: 'POST',
    data: params,
    responseType: 'blob',
  });
}

// 图纸打印列表
export async function getDrawingPrintHstByWoIdAndPage(params: any) {
  return request('/api/product/getDrawingPrintHstByWoIdAndPage', {
    method: 'POST',
    data: params,
  });
}

// 获取超时工单数据
export async function getWorkOrderInforExtendWarnByPage(params: any) {
  return request('/api/product/getWorkOrderInforExtendWarnByPage', {
    method: 'POST',
    data: params,
  });
}

// 新增图纸打印记录
export async function addDrawingPrintHst(params: any) {
  return request('/api/product/addDrawingPrintHst', {
    method: 'POST',
    data: params,
  });
}

// 获取当前用户名
export async function viewBaseInfo(params: any) {
  return request('/api/user/viewBaseInfo', {
    method: 'POST',
    data: params,
  });
}

//获取url/product/getDrawingPreviewUrl
export async function getDrawingPreviewUrl(params: any) {
  return request('/api/product/getDrawingPreviewUrl', {
    method: 'POST',
    params: {
      productDrawingInfoId: params,
    },
  });
}

//关闭工单/product/closeWorkOrderInfor
export async function closeWorkOrderInfor(params: any) {
  return request('/api/product/closeWorkOrderInfor', {
    method: 'POST',
    params: {
      workOrderInfoId: params,
    },
  });
}

export default {
  getWorkOrderInforByPage,
  getWorkOrderInforExtendByPage,
  addWorkOrderInfor,
  updateWorkOrderInfor,
  delWorkOrderInfor,
  exportWorkOrderInfor,
};
